package com.nextgenapp.fbgraph.post
{
	import com.nextgenapp.fbgraph.GraphApi;
	import com.nextgenapp.fbgraph.common.GraphConst;
	
	/**
	 * post a comment. 
	 */
	public class PostComment
	{
		public static var apiUrl:String = GraphConst.PROTOCOL + "://graph.facebook.com/{post_id}/comments";
		
		public var access_token:String = null;
		
		public function PostComment()
		{
		}
		
		/**
		 * post comment by giving comment url
		 * this is useful because in some situation we already know the comment url from the feed.
		 */
//		public function postCommentByUrl(commentUrl:String, message:String):void {
//			var parameters:Object = {};
//			parameters.message = message;
//			var graphApi:GraphApi = new GraphApi();
//			graphApi.write(commentUrl, parameters);
//		}
		
		/**
		 * post to url: /postId/comments
		 */
		public function postData(postId:String, message:String):void {
			var url:String = apiUrl.replace("{post_id}", postId);
			var parameters:Object = {};
			parameters.message = message;
			var graphApi:GraphApi = new GraphApi();
			graphApi.write(url, parameters);
		}
		
	}
}